<#assign pageTitle="我的收藏"/>
<#assign pageHeader>
    <link rel="stylesheet" type="text/css" href="/static/h5/css/user.css?20220210"/>
</#assign>
<#assign pageContent>
    <van-nav-bar
            title="我的收藏"
            left-text="返回"
            left-arrow
            @click-left="location.href='/user/index.html';"
            fixed
            placeholder
    ></van-nav-bar>
    <van-tabs  class="user-tab" @click="clickTab()"  v-model="activeTab" animated  sticky>
        <van-tab title="课程(${courseCount})">
            <div class="main-item">
                <div class="course-card">
                    <van-row gutter="20">
                        <#if typeId == 2>
                            <#if favoriteList?? && favoriteList?size gt 0 >
                                <#list favoriteList as itme>
                                     <van-col span="12">
                                        <a href="/course/view/${itme.infoId!}.html" class="relative">
                                            <div class="course-pic"><img src="${itme.cover!}" alt=""></div>
                                            <div class="course-info">
                                                <div class="course-name text-two">${itme.title!}</div>
                                            </div>
                                            <div class="course-price">
                                                <div class="fl">主讲：
                                                    <#if itme.teacherList?? && itme.teacherList?size gt 0>
                                                        <#list itme.teacherList as teacher>
                                                            ${teacher.name!}
                                                         </#list>
                                                        <#else>
                                                          无
                                                    </#if>
                                                </div>
                                                <div class="fr">¥${itme.price/100}</div>
                                            </div>
                                            </a>
                                    </van-col>
                                </#list>
                            </#if>
                        </#if>
                    </van-row>
                </div>
            </div>
        </van-tab>
        <van-tab title="教材(${bookCount})">
            <div class="main-item">
                <div class="course-list book-list">
                        <#if typeId == 3>
                            <#if favoriteList?? && favoriteList?size gt 0 >
                                <#list favoriteList as itme>
                                     <a href="/book/view/${itme.infoId}.html" class="relative">
                                        <div class="course-pic"><img src="${itme.cover}" alt=""></div>
                                        <div class="course-info">
                                            <div class="course-name text-two">${itme.title}</div>
                                            <div class="course-des text-two">${itme.title}</div>
                                            <div class="course-time">${itme.title}</div>
                                            <div class="course-price">¥${itme.price/100}</div>
                                        </div>
                                    </a>
                                </#list>
                         </#if>
                    </#if>
                </div>
            </div>
        </van-tab>
        <van-tab title="素材(${pictureCount})">
            <div class="main-item">
                <div class="picture-list">
                           <#if typeId == 4>
                            <#if favoriteList?? && favoriteList?size gt 0 >
                                <#list favoriteList as itme>
                                    <a class="picture-item relative" href="/picture/view/${itme.infoId}.html" >
                                        <div class="picture-img"><img src="${itme.cover!}" alt=""></div>
                                        <div class="picture-name text-one">${itme.title!}</div>
                                    </a>
                                </#list>
                            </#if>
                        </#if>
                </div>
            </div>
        </van-tab>
        <van-tab title="资料(${documenrCount})">
            <div class="main-item">
                <div class="picture-list">
                    <#if typeId == 5>
                        <#if favoriteList?? && favoriteList?size gt 0 >
                            <#list favoriteList as itme>
                                <a class="picture-item relative" href="/document/view/${itme.infoId}.html" >
                                    <div class="picture-img"><img src="${itme.cover!}" alt=""></div>
                                    <div class="picture-name text-one">${itme.title!}</div>
                                </a>
                            </#list>
                        </#if>
                    </#if>
                </div>
            </div>
        </van-tab>
    </van-tabs>
    <div v-if="typeId == 2 && pageCount == 0">
        <van-empty description="您还没有收藏任何课程..."></van-empty>
        <div style="padding: 0 12px"  v-if="pageCount == 0"><van-button  type="info" size="large" url="/course/pro/list.html">看看有什么课程</van-button></div>
    </div>
    <div v-if="typeId == 3 && pageCount == 0">
        <van-empty description="您还没有收藏任何教材..."></van-empty>
        <div style="padding: 0 12px"  v-if="pageCount == 0"><van-button  type="info" size="large" url="/book/index.html">看看有什么教材</van-button></div>
    </div>
    <div v-if="typeId == 4 && pageCount == 0">
        <van-empty description="您还没有收藏任何素材..."></van-empty>
        <div style="padding: 0 12px"  v-if="pageCount == 0"><van-button  type="info" size="large" url="/picture/index.html">看看有什么素材</van-button></div>
    </div>
    <div v-if="typeId == 5 && pageCount == 0">
        <van-empty description="您还没有收藏任何资料..."></van-empty>
        <div style="padding: 0 12px"  v-if="pageCount == 0"><van-button  type="info" size="large" url="/document/index.html">看看有什么资料</van-button></div>
    </div>
    <van-pagination v-model="currentPage" v-if="pageCount !=0 " :page-count="pageCount" mode="simple"  class="mb-12 pd-12" @change="pageChange"></van-pagination>
</#assign>
<#assign pageScript>

    <script>
        var pageCount = ${totalPages};
        var currentPage = ${page.currentPage};
        var typeId = ${typeId};
        var active = 0;
        new Vue({
            el: '#app',
            data() {
                return {
                    showFooter: false,
                    pageCount: pageCount,
                    currentPage: currentPage,
                    activeTab:(typeId-2)
                }
            },
            created() {

            },
            methods: {
                pageChange(value) {
                    window.location.href = '/user/favorite.html?typeId='+typeId+'&page=' + value;
                },
                clickTab(){
                    window.location.href = '/user/favorite.html?typeId='+(this.activeTab+2)
                }
            }
        });
    </script>
</#assign>
<#include "../layout_h5.ftl" />